package com.ysfxt.auth;

import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/**
 * @author 盐酸氟西汀
 * @create 2024/1/25 20:22
 * @email 480738950@qq.com
 */
@Configuration
public class LoginMvcConfigurerAdapter implements WebMvcConfigurer {
    
    @Resource
    private RedisTemplate redisTemplate;
    
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //添加自定义拦截器，设置路径
        registry.addInterceptor(
                        new UserLoginInterceptor(redisTemplate))
                .addPathPatterns("/api/**")
                .excludePathPatterns("/api/sys-user/login","/api/user/login");
    }
}